var app = angular.module('moGu');
app.run(function(){
    if(window.location.hash=='#/home' || window.location.hash==''){
      $("#home").trigger("click");
    }
    if(window.location.hash.substring(0,10)=='#/catetory'){
      $("#catetory").trigger("click");
    }
    if(window.location.hash=='#/mine' ){
      $("#mine").trigger("click");
    }
});
app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider){

  // 默认路由
  $urlRouterProvider.when('', '/home');
  $urlRouterProvider.when('/catetory', '/catetory/41888');
  // 一级路由
  $stateProvider.state('home', {
    url: '/home',
    templateUrl: './home/home.html'
  }).state('catetory', {
    url: '/catetory',
    templateUrl: './catetory/catetory.html'
  }).state('car', {
    url: '/car',
    templateUrl: './car/car.html'
  }).state('mine', {
    url: '/mine',
    templateUrl: './mine/mine.html'
    }).state('login', {
        url: '/login',
        templateUrl: './login/login.html'
    })
  // 二级路由
    .state('catetory.41888', {
      url: '/41888',
      templateUrl: './catetory/html/1.html'
    }).state('catetory.41846', {
      url: '/41846',
      templateUrl: './catetory/html/2.html'
    }).state('catetory.41851', {
      url: '/41851',
      templateUrl: './catetory/html/3.html'
    }).state('catetory.41860', {
      url: '/41860',
      templateUrl: './catetory/html/4.html'
    }).state('catetory.41855', {
      url: '/41855',
      templateUrl: './catetory/html/5.html'
    }).state('catetory.41859', {
      url: '/41859',
      templateUrl: './catetory/html/6.html'
    }).state('catetory.41853', {
      url: '/41853',
      templateUrl: './catetory/html/7.html'
    }).state('catetory.41863', {
      url: '/41863',
      templateUrl: './catetory/html/8.html'
    }).state('catetory.41874', {
      url: '/41874',
      templateUrl: './catetory/html/10.html'
    }).state('catetory.41892', {
      url: '/41892',
      templateUrl: './catetory/html/9.html'
    }).state('catetory.41875', {
      url: '/41875',
      templateUrl: './catetory/html/11.html'
    }).state('catetory.41878', {
      url: '/41878',
      templateUrl: './catetory/html/12.html'
    })
    .state('catetory.41879', {
      url: '/41879',
      templateUrl: './catetory/html/13.html'
    }).state('catetory.41880', {
      url: '/41880',
      templateUrl: './catetory/html/14.html'
    }).state('catetory.41884', {
      url: '/41884',
      templateUrl: './catetory/html/15.html'
    }).state('catetory.41886', {
      url: '/41886',
      templateUrl: './catetory/html/16.html'
    })

}])
